package fr.chatellier.onlinemanager.server;

import java.util.List;

import fr.chatellier.onlinemanager.client.EventService;
import fr.chatellier.onlinemanager.client.data.EventClient;

import com.google.gdata.client.spreadsheet.SpreadsheetService;
import com.google.gdata.util.AuthenticationException;
import com.google.gwt.user.server.rpc.RemoteServiceServlet;

/**
 * The server side implementation of the RPC service.
 */
@SuppressWarnings("serial")
public class EventServiceImpl extends RemoteServiceServlet implements
		EventService {

	public void saveEvent(EventClient input) {
		String serverInfo = getServletContext().getServerInfo();
		String userAgent = getThreadLocalRequest().getHeader("User-Agent");
	}
	
	public List<EventClient> getEvents() {
		SpreadsheetService myService = new SpreadsheetService("exampleCo-exampleApp-1");
		try {
			myService.setUserCredentials("jo@gmail.com", "mypassword");
		} catch (AuthenticationException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		String serverInfo = getServletContext().getServerInfo();
		String userAgent = getThreadLocalRequest().getHeader("User-Agent");
		return null;
	}
}
